<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:jsf="http://xmlns.jcp.org/jsf"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">

    <h:form>
        <p:commandButton value="CREAR UN NUEVO EMPLEADO"
                         update=":panelContent">
            <f:setPropertyActionListener
                target="#{navigationController.navigationContent}"
                value="./pages/administration/employee_create.xhtml" />
        </p:commandButton>
    </h:form>

    <h:form>
        <h1><h:outputText value="List"/></h1>
        <p:dataTable value="#{employeeRoleController.listEmployee}" var="item">
            <p:column width="5">
                <p:menuButton styleClass="menubutton-for-table">  
                    <p:menuitem value="Editar" icon="ui-icon-pencil" update=":panelContent">  
                        <f:setPropertyActionListener
                            target="#{employeeRoleController.employee}"
                            value="#{item}" />
                        <f:setPropertyActionListener
                            target="#{navigationController.navigationContent}"
                            value="./pages/administration/employee_create.xhtml" />
                    </p:menuitem>
                    <p:menuitem value="Eliminar" icon="ui-icon-person"
                                update="@form" action="#{employeeRoleController.removeEmployee(item)}">
                    </p:menuitem>
                </p:menuButton>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="FirstName"/>
                </f:facet>
                <h:outputText value="#{item.firstName}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="LastName"/>
                </f:facet>
                <h:outputText value="#{item.lastName}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Dni"/>
                </f:facet>
                <h:outputText value="#{item.dni}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Phone"/>
                </f:facet>
                <h:outputText value="#{item.phone}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Address"/>
                </f:facet>
                <h:outputText value="#{item.address}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="UserName"/>
                </f:facet>
                <h:outputText value="#{item.userName}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="PasswordName"/>
                </f:facet>
                <h:outputText value="#{item.passwordName}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Role"/>
                </f:facet>
                <h:outputText value="#{item.role}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="ShopId"/>
                </f:facet>
                <h:outputText value="#{item.shopId.name}"/>
            </p:column>
        </p:dataTable>
    </h:form>


</ui:composition>
